Conversation
|
If we want to deprecate this, there needs to be some deprecation warning for users. We can't just flip the switch and possibly break every second person's config. A good way to do that is to change the |
4c0cfbd to
2412d3b
Compare
|
Ok, I removed the attempts to replace loaOf with attrsOf and added a deprecation warning. |
lib/types.nix
Outdated
There was a problem hiding this comment.
Yeah this isn't what we need. The warning needs to go in the merge function. There one has access to all definitions, which can then be filtered to lists only, and for each of them one can print a warning as I showed in my comment. would be even neater to include the file and line where the user needs to do this change.
I generally think our error messages suck too much. It's not too difficult to make them better, especially with all the info the module system gives access to.
There was a problem hiding this comment.
Ok, I'm working on it.
There was a problem hiding this comment.
I took me a while but I think this should do it:
trace: warning: In file <nixpkgs/nixos/modules/services/misc/nix-daemon.nix>
a list is being assigned to the option config.users.users.
This will soon be an error as type loaOf is deprecated.
See https://git.io/fj2zm for more information.
Do
users.users =
{ nixbld1 = {...}; nixbld2 = {...}; nixbld3 = {...}; ...}
instead of
users.users =
[ { name = "nixbld1"; ...} { name = "nixbld2"; ...} { name = "nixbld3"; ...} ...]
There was a problem hiding this comment.
Uhm, no it doesn't work when the set is missing the name attribute.
There was a problem hiding this comment.
I mean, it does but it's not pretty.
|
This will break the programs.ssh.matchBlocks option in Home Manager. That option allows use of list when the order matters and an attribute set as a convenience for users whose setup does not require a certain order. I believe I originally had it as a I don't particularly mind switching back to |
|
@rycee I don't know how home-manager works: are you somehow bound to nixos option types? Couldn't you simply define an equivalent loaOf for home-manager? |
ef6ce8b to
fdab0a3
Compare
5d7cfe4 to
57440d5
Compare
|
Thank you everyone, especially @rnhmjoj for your hard work!! 🎉 |
No, it's not a problem: I have written documentation for NixOS before.
Ok, I'll do something like it. Thank you. |
|
I think there should be a pinned issue for this, since it will throw warnings and errors for many people and the efforts to fix those should be coordinated somehow. |
Sounds good to me, will open. |
|
Made a little pop up issue #77189. Should have relevant strings within the body to pop up in relevancy searches. |
|
The deprecation should probably be documented in |
A mistake was introduced in NixOS#63103
|
I just want to say I got the most wonderful error message from a Nix evaluation today: This error message: ✔️ is specific: "a list is being assigned to the option config.programs.ssh.knownHosts" ✔️ tells me where to go for more information: https://git.io/fj2zm ✔️ tells me where the violation is: ✔️ SHOWS me the code which is wrong: ✔️ AND tells me the solution: This is incredible, and ticks the main three boxes of good errors:
Way to go everyone, this is a massive step forward for our community and I am completely floored and delighted. Thank you. |
Motivation for this change
Fix issue #1800.
It turns out this is a lot of work: there are many instances of lists being used instead of sets.
The main culprits are
users.usersandenvironment.etc.I think I have identified most of them but there are still some, moreover all this changes should be properly tested so I definitely need some help.